<?php

class Application_Model_backlog extends Application_Model_DomainObject {

	/**
	 * 未处理
	 * @var unknown_type
	 */
	const STATUS_untreated = 0;

	/**
	 * 已处理
	 * @var unknown_type
	 */
	const STATUS_processed=1;

	protected  $_id;

	protected $_userid;

	protected $_username;

	protected $_title;

	protected $_content;

	protected $_status;
        
        protected $_remark;
        
        protected $_crdatetime;
       
        public static function getselbacklog($nikename,$storeno,$starttime,$endtime,$status,$pagesize,$pageindex)
        {
            $where = array();
            $and = "";
            if($nikename != ""){
                $where[$and." username = "] = $nikename;
                $and = " and ";
            }
            if($storeno != ""){
                $result = Application_Model_User::getByStoreNo($storeno);
                if($result){
                    $where[$and." userid = "] = $result->id;
                    $and = " and ";
                }else{
                    return NULL;
                }
            }
            if($starttime != ""){
                $where[$and . " crdetatime >= "] = $starttime;
                $and = " and ";
            }
            if($endtime != ""){
                $where[$and . " crdetatime <= "] = $endtime;
                $and = " and ";
            }
            if($status != ""){
                $where[$and." status = "] = $status;
                $and = " and ";
            }
            return Application_Model_backlog::getDao()->queryPage($where, ' id desc', $pagesize, $pageindex);;
        }
        
        public function getuserde()
        {
            if($this->_userid){
                return Application_Model_User::load($this->_userid);
            }
        }
}